public class Solution461 {
    public int hammingDistance(int x, int y) {
        int m=x^y;
        int ans=0;
        while (m!=0){
            m=(m&(m-1));
            ans++;
        }
        return ans;
    }

    public static void main(String[] args) {
        System.out.println(new Solution461().hammingDistance(1,4));
    }
}
